<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title>Document</title>
    </head>
    <body>
        <h1>箭头函数</h1>
        <p>来源:<a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions">https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions</a></p>
        <h2>通过call或apply调用</h2>
        <p>由于 this 已经在词法层面完成了绑定，通过 call() 或 apply() 方法调用一个函数时，只是传入了参数而已，对 this 并没有什么影响：</p>
        <script>
            var adder = {
              base : 1,
                
              add : function(a) {
                var f = v => v + this.base;
                return f(a);
              },

              addThruCall: function(a) {
                var f = v => v + this.base;
                var b = {
                  base : 2
                };
                        
                return f.call(b, a);
              }
            };

            console.log(adder.add(1));         // 输出 2
            console.log(adder.addThruCall(1)); // 仍然输出 2（而不是3 ——译者注）
        </script>
    </body>
</html>